
// 当前案例为外部引入  Vue  VueRouter 全局的   -> 无法做模块引入
// import Vue from "vue"
// import VueRouter from "vue-router"
// Vue.use(VueRouter);

// 2. 定义组件  => 组件相关的配置
import Home from "../views/Home.js";
import List from "../views/List.js";
import Car from "../views/Car.js";
import Mine from "../views/Mine.js";
import NotFound from "../views/NotFound.js";

//  3. 路由配置 => 将路由(自定义路径)和组件关联起来  => 
//  每个路由应该映射一个组件。 其中"component" 可以是
let routes = [{
    path: "/",
    name: "home",
    component: Home,
}, {
    path: "/list",
    name: "list",
    component: List,
}, {
    path: "/car",
    name: "car",
    component: Car,
}, {
    path: "/mine",
    name: "mine",
    component: Mine,
},{
    path: "/404",
    name: "not-found",
    component: NotFound,
},{
    path: "*",  // 除了上述路径以外的所有其他路径  -> 渲染NotFound
    component: NotFound,
}]

// 4. 创建 router 实例，然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new VueRouter({
    routes:routes // (缩写) 相当于 routes: routes
})


export default router;